<!DOCTYPE html>
<?php
   //第一步：连接数据库
   require 'db_conn.php';//如果这个文件不存在，则程序终止
   //第二步：写查询语句并执行
   $sql="select * from tb_emp ORDER BY e_id asc";
   $rs=$db->query($sql);
   //取结果集的行数，留言板表有多少条留言
   $num=$rs->num_rows;
   $bbs=$rs->fetch_all(MYSQLI_ASSOC);//将结果集转化为数组-关联数组，下标为字符串
?>

<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>员工信息</title>
	<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
	<script src="./js/jquery-3.5.1.js"></script>
	<script src="./js/bootstrap.min.js"></script>
</head>
<body>
	<div class="container">
		<h1 class="text-center">员工信息表</h1>
		<table class="table table-bordered table-hover text-center">
			<tr>
				<th>编号</th>
				<th>姓名</th>
				<th>部门</th>
				<th>头像</th>
				<th>生日</th>
				<th>入职日期</th>
				<th>操作事项</th>
			</tr>
			<?php foreach($bbs as $v){
				
			 ?>
			<tr style="line-height: 45px;">
				<td><?php echo $v['e_id'] ?></td>
				<td><?php echo $v['e_name'] ?></td>
				<td><?php echo $v['e_dept'] ?></td>
				<td><img src="<?php echo $v['e_img'] ?>" alt=""></td>
				<td><?php echo $v['date_of_birth'] ?></td>
				<td><?php echo $v['date_of_entry'] ?></td>
				<td>
					<a href="" class="btn btn-info">操作</a>
					<a class="btn btn-danger" href="javascript:" onclick="if(confirm('确定删除吗？')) location.href='empdel.php?id=<?php echo $v['e_id'] ?>'" >删除</a>
				</td>
				<?php } ?>
			</tr>
		</table>
					<h1 class="text-center">添加员工信息</h1>
					<form action="upadd.php" method="post">
						<p>姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:<input class="name" name="name" type="text" placeholder="你的名字" /></p>
						<p>部&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;门:<input class="name" name="dept" type="text" placeholder="你的部门" /></p>
						<p>生&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;日:<input class="name" name="date_of_birth" type="datetime-local" placeholder="你的生日" /></p>
						<p>入职时间:<input class="name" name="date_of_entry" type="datetime-local" placeholder="你的入职时间" /></p>
						<p class="tow">
							<input type="radio" name="imgurl" value="images/1.jpg" checked="checked" /><img src=" images/1.jpg" alt="" />
							<input type="radio" name="imgurl" value="images/2.jpg" /><img src=" images/2.jpg" alt="" />
							<input type="radio" name="imgurl" value="images/3.jpg" /><img src=" images/3.jpg" alt="" />
							<input type="radio" name="imgurl" value="images/4.jpg" /><img src=" images/4.jpg" alt="" />
						</p>
					
						<p class="btn btn-info"><input class="btn btn-info" type="submit" value="增加员工" /></p>
					</form>
		
	</div>

</body>
</html>